<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<!--父组件模板-->
<div id="app">
  <cpn><button>按钮</button></cpn>
  <cpn><span>哈哈哈</span></cpn>
  <cpn><i>呵呵呵</i></cpn>
  <cpn></cpn>
</div>

<template id="cpn">
  <div>
    <h1>我是组件</h1>
    <p>我是组件,哈哈哈</p>
    <slot><button>按钮</button></slot><!--相当于给一个默认值 -->
  </div>
</template>


<script src="../js/vue%20.js"></script>
<script>

  //父组件
  const app = new Vue({
    el:'#app',
    data:{
      num1: 1,
      num2: 0,
    },
    components: {
      cpn: {
        template: '#cpn'
      }
    }
  })
</script>
</body>
</html>